package com.niodata.dp.task.entity;

import com.niodata.dp.util.TimeUtil;
import java.util.Date;

public class DynamicExecution {

  private String name;
  private String description;
  private long ownerId;
  private String ownerType;
  private String taskName;
  private String id;
  private int execId;
  private Date startTime;
  private JobParams params;
  private String status;
  private Date endTime;
  private boolean userCreate = true;
  private String type;
  private String taskId;

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public long getOwnerId() {
    return ownerId;
  }

  public void setOwnerId(long ownerId) {
    this.ownerId = ownerId;
  }

  public String getOwnerType() {
    return ownerType;
  }

  public void setOwnerType(String ownerType) {
    this.ownerType = ownerType;
  }

  public String getTaskName() {
    return taskName;
  }

  public void setTaskName(String taskName) {
    this.taskName = taskName;
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public int getExecId() {
    return execId;
  }

  public void setExecId(int execId) {
    this.execId = execId;
  }

  public Date getStartTime() {
    return startTime;
  }

  public void setStartTime(Date startTime) {
    this.startTime = startTime;
  }

  public JobParams getParams() {
    return params;
  }

  public void setParams(JobParams params) {
    this.params = params;
  }

  public String getStatus() {
    return status;
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public Date getEndTime() {
    return endTime;
  }

  public void setEndTime(Date endTime) {
    this.endTime = endTime;
  }

  public String getTaskId() {
    return taskId;
  }

  public void setTaskId(String taskId) {
    this.taskId = taskId;
  }

  public boolean isUserCreate() {
    return userCreate;
  }

  public void setUserCreate(boolean userCreate) {
    this.userCreate = userCreate;
  }

  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  public String getDuration() {
    if (startTime != null && endTime != null && endTime.compareTo(startTime) >= 0) {
      return TimeUtil.toReadableDuration(startTime, endTime);
    }
    return "";
  }
}
